﻿<?php
	error_reporting (E_ALL ^ E_NOTICE);
	include("./config/conn_database.php");
	$strSQL = "SELECT * 
			   FROM add_member 
			   WHERE mem_pid = '".$_POST['pid']."'
			   AND mem_uname = '".$_POST['uname']."'";
	$objQuery = mysql_query($strSQL);
	$objResult = mysql_fetch_array($objQuery);
	if($objResult){
		$strSQL = "UPDATE add_member 
					SET mem_pname = MD5('".$_POST['pname']."') 
					WHERE mem_pid = '".$_POST['pid']."' 
					AND mem_uname = '".$_POST['uname']."'";
		$objQuery = mysql_query($strSQL);
		if($objQuery){
			echo "<script type='text/javascript'>";		
			echo "alert('บันทึกข้อมูลสำเร็จ')";
			echo "</script>";
			echo "<meta http-equiv='refresh' content='0; url=index.php'>";
		}else{
			echo "<script type='text/javascript'>";
			echo "alert('บันทึกข้อมูลไม่สำเร็จ : ติดต่อผู้ดูแลระบบ')";
			echo "</script>";
			echo "<meta http-equiv='refresh' content='0; url=mem_edit_passwd.php'>";
		}
	}else{
		echo "<script type='text/javascript'>";
		echo "alert('บันทึกข้อมูลไม่สำเร็จ : ติดต่อผู้ดูแลระบบ')";
		echo "</script>";
		echo "<meta http-equiv='refresh' content='0; url=mem_edit_passwd.php'>";
	}
	mysql_close($objConnect);
?>
